home *** CD-ROM | disk | FTP | other *** search
/ Champak 49 / Volume 49 - JOGO DISK .iso / Games / fruitselect.swf / scripts / frame_1 / DoAction.as
Encoding:
Text File  |  2007-10-01  |  30.2 KB  |  1,109 lines

  1. stop();
  2. System.useCodepage = true;
  3. init = function()
  4. {
  5.    hh = 0;
  6.    pauseTime = 0;
  7.    levelNum = 0;
  8.    scoreNum = 30;
  9.    plusScore = 30;
  10.    lengGap = 8;
  11.    targetScore = 0;
  12.    judArr = [2,-16,-2,16];
  13.    itemArr = [1,2,3,4,5,6,7,8];
  14.    noMatchChkArr = [[-2,-3],[-8,-18],[2,3],[8,16]];
  15.    itemSpeed = 0.4;
  16.    goodS = new Sound(this);
  17.    goodS.attachSound("good");
  18.    badS = new Sound(this);
  19.    badS.attachSound("bad");
  20.    clickS = new Sound(this);
  21.    clickS.attachSound("click");
  22.    startS = new Sound(this);
  23.    startS.attachSound("start");
  24.    bonusS = new Sound(this);
  25.    bonusS.attachSound("bonus");
  26.    endS = new Sound(this);
  27.    endS.attachSound("end");
  28.    bgS = new Sound(this);
  29.    bgS.attachSound("bgsnd");
  30.    timeS = new Sound(this);
  31.    timeS.attachSound("timeLimit");
  32.    this.createEmptyMovieClip("waitTimeMc",10000);
  33. };
  34. gameStart = function()
  35. {
  36.    gotoAndStop(3);
  37.    startS.start(0,1);
  38.    bgS.start(0,999);
  39.    gameST = getTimer() / 1000;
  40.    gameArrange();
  41. };
  42. RESTART = function()
  43. {
  44.    k = 0;
  45.    while(k < 5)
  46.    {
  47.       gameOverBoard.rankTMC["mc" + k].gotoAndStop(1);
  48.       gameOverBoard.scoreTMC["mc" + k].gotoAndStop(1);
  49.       scoreTMC["mc" + k].gotoAndStop(1);
  50.       targetScoreTMC["mc" + k].gotoAndStop(1);
  51.       k++;
  52.    }
  53.    gameOverBoard._visible = 0;
  54.    levelNum = 0;
  55.    scoreNum = 30;
  56.    targetScore = 0;
  57.    startS.start(0,1);
  58.    bgS.start(0,999);
  59.    gameST = getTimer() / 1000;
  60.    gameArrange();
  61. };
  62. gameArrange = function()
  63. {
  64.    dep = 0;
  65.    choose = 0;
  66.    matchNum = 0;
  67.    pauseTime = 0;
  68.    mission02Num = 0;
  69.    dupItemMcArr = [];
  70.    itemEmptyMcArr = [];
  71.    currentScore = 0;
  72.    gamePlay = true;
  73.    makedLEVELTXT();
  74.    scorePlus(0);
  75.    mission01Num = random(itemLengChk) + 1;
  76.    missionMc01.gotoAndStop(mission01Num);
  77.    missionMc02.mission02WaitCHK();
  78.    posY = 0;
  79.    tempBackDiv = 2;
  80.    itemGroup.itemMc._visible = 0;
  81.    k = 0;
  82.    while(k < lengGap)
  83.    {
  84.       posX = 0;
  85.       h = 0;
  86.       while(h < lengGap)
  87.       {
  88.          dep++;
  89.          temp = itemGroup.itemMc.duplicateMovieClip("item_" + dep,dep);
  90.          dupItemMcArr.push(temp);
  91.          itemEmptyMcArr.push(temp);
  92.          temp.itemDoubleCheck(dep);
  93.          temp._x = posX;
  94.          temp._y = posY;
  95.          temp.xno = dep - 1;
  96.          temp.mcx = h + 1;
  97.          temp.mcy = k + 1;
  98.          posX += 50;
  99.          temp.onRollOver = function()
  100.          {
  101.             this.outFrame = this.bg_mc._currentframe;
  102.             this.bg_mc.gotoAndStop(2);
  103.          };
  104.          temp.onRollOut = temp.onReleaseOutside = function()
  105.          {
  106.             delete this.onEnterFrame;
  107.             this.bg_mc.gotoAndStop(this.outFrame);
  108.          };
  109.          temp.onPress = function()
  110.          {
  111.             this.outFrame = 3;
  112.             this.bg_mc.gotoAndStop(3);
  113.             this.mc.gotoAndStop(2);
  114.             if(choose)
  115.             {
  116.                chooseMc_1 = this;
  117.                if(chooseMc_1._name == chooseMc_0._name)
  118.                {
  119.                   this.outFrame = 1;
  120.                   this.bg_mc.gotoAndStop(1);
  121.                   chooseMc_0 = chooseMc_1 = null;
  122.                   choose = 0;
  123.                   badS.start(0,1);
  124.                }
  125.                else
  126.                {
  127.                   changeItem();
  128.                }
  129.             }
  130.             else
  131.             {
  132.                clickS.start(0,1);
  133.                choose++;
  134.                chooseMc_0 = this;
  135.                this.onEnterFrame = function()
  136.                {
  137.                   if(this._parent._xmouse > 0 && this._parent._xmouse < 400 && this._parent._ymouse > 0 && this._parent._ymouse < 400)
  138.                   {
  139.                      if(this._parent._xmouse < this._x - 5)
  140.                      {
  141.                         chooseMc_1 = dupItemMcArr[this.xno - 1];
  142.                         delete this.onEnterFrame;
  143.                         changeItem();
  144.                      }
  145.                      else if(this._parent._xmouse > this._x + 55)
  146.                      {
  147.                         chooseMc_1 = dupItemMcArr[this.xno + 1];
  148.                         delete this.onEnterFrame;
  149.                         changeItem();
  150.                      }
  151.                      else if(this._parent._ymouse < this._y - 5)
  152.                      {
  153.                         chooseMc_1 = dupItemMcArr[this.xno - 8];
  154.                         delete this.onEnterFrame;
  155.                         changeItem();
  156.                      }
  157.                      else if(this._parent._ymouse > this._y + 55)
  158.                      {
  159.                         chooseMc_1 = dupItemMcArr[this.xno + 8];
  160.                         delete this.onEnterFrame;
  161.                         changeItem();
  162.                      }
  163.                   }
  164.                };
  165.             }
  166.          };
  167.          temp.onRelease = function()
  168.          {
  169.             delete this.onEnterFrame;
  170.          };
  171.          temp.useHandCursor = false;
  172.          h++;
  173.       }
  174.       posY += 50;
  175.       k++;
  176.    }
  177.    gageMc.timeCheckStart();
  178.    waitTimeMc.waitTimeCheck(5,1);
  179. };
  180. nextLevel = function()
  181. {
  182.    successBoard._visible = 0;
  183.    gameArrange();
  184. };
  185. makedLEVELTXT = function()
  186. {
  187.    levelNum++;
  188.    chk = levelNum % 4;
  189.    if(chk)
  190.    {
  191.       fn = Math.floor(levelNum / 4) + 1;
  192.       bn = levelNum - (fn - 1) * 4;
  193.    }
  194.    else
  195.    {
  196.       fn = levelNum / 4;
  197.       bn = 4;
  198.    }
  199.    if(fn < 4)
  200.    {
  201.       itemLengChk = 7;
  202.    }
  203.    else
  204.    {
  205.       itemLengChk = 8;
  206.    }
  207.    targetScore += 500 + (fn - 1) * 500;
  208.    levelTxt0Mc.gotoAndStop(fn + 2);
  209.    levelTxt1Mc.gotoAndStop(bn + 2);
  210.    targetScoreTMC.makedNumbering(targetScore);
  211.    gageMc.barMc._xscale = gageGap = 60 - (fn - 1) * 5;
  212. };
  213. scorePlus = function(num)
  214. {
  215.    scoreNum += num;
  216.    scoreTMC.makedNumbering(scoreNum);
  217. };
  218. MovieClip.prototype.timeCheckStart = function()
  219. {
  220.    this.ST = getTimer() / 1000;
  221.    this.onEnterFrame = function()
  222.    {
  223.       this.PT = getTimer() / 1000 - this.ST + pauseTime;
  224.       scale = gageGap - this.PT;
  225.       this.barMc._xscale += (scale - this.barMc._xscale) * 0.5;
  226.       if(this.barMc._xscale >= 100)
  227.       {
  228.          this.barMc._xscale = 100;
  229.          gageGap = 100 + this.PT;
  230.       }
  231.       if(this.barMc._xscale < 21)
  232.       {
  233.          if(limitSoundCHK)
  234.          {
  235.             timeS.start(0,2);
  236.             limitSoundCHK = false;
  237.             this.barMc.gotoAndStop(2);
  238.          }
  239.          this.gotoAndStop(2);
  240.       }
  241.       else
  242.       {
  243.          limitSoundCHK = true;
  244.          this.gotoAndStop(1);
  245.          this.barMc.gotoAndStop(1);
  246.       }
  247.       if(this.barMc._xscale <= 0)
  248.       {
  249.          delete this.onEnterFrame;
  250.          gameOver();
  251.       }
  252.    };
  253. };
  254. changeItem = function()
  255. {
  256.    hideMc._visible = 1;
  257.    tempGap = Math.abs(chooseMc_0.no - chooseMc_1.no);
  258.    if(tempGap == lengGap || tempGap == 1 && chooseMc_0.rowType == chooseMc_1.rowType)
  259.    {
  260.       clickS.start(0,1);
  261.       view0Mc = itemGroup.itemMc.duplicateMovieClip("view0",1000);
  262.       view1Mc = itemGroup.itemMc.duplicateMovieClip("view1",1001);
  263.       view0Mc._x = chooseMc_0._x;
  264.       view0Mc._y = chooseMc_0._y;
  265.       view1Mc._x = chooseMc_1._x;
  266.       view1Mc._y = chooseMc_1._y;
  267.       view0X = view1Mc._x;
  268.       view0Y = view1Mc._y;
  269.       view1X = view0Mc._x;
  270.       view1Y = view0Mc._y;
  271.       view0Mc.itemType = chooseMc_0.itemType;
  272.       view1Mc.itemType = chooseMc_1.itemType;
  273.       view0Mc.gotoAndStop(chooseMc_0.itemType);
  274.       view0Mc.mc.gotoAndStop(2);
  275.       view1Mc.gotoAndStop(chooseMc_1.itemType);
  276.       view1Mc.mc.gotoAndStop(2);
  277.       chooseMc_0._visible = chooseMc_1._visible = 0;
  278.       itemGroup.onEnterFrame = function()
  279.       {
  280.          view0Mc._x += (view0X - view0Mc._x) * itemSpeed;
  281.          view0Mc._y += (view0Y - view0Mc._y) * itemSpeed;
  282.          view1Mc._x += (view1X - view1Mc._x) * itemSpeed;
  283.          view1Mc._y += (view1Y - view1Mc._y) * itemSpeed;
  284.          if(view0Mc._x > view0X - 1 && view0Mc._x < view0X + 1)
  285.          {
  286.             if(view0Mc._y > view0Y - 1 && view0Mc._y < view0Y + 1)
  287.             {
  288.                if(view1Mc._x > view1X - 1 && view1Mc._x < view1X + 1)
  289.                {
  290.                   if(view1Mc._y > view1Y - 1 && view1Mc._y < view1Y + 1)
  291.                   {
  292.                      delete this.onEnterFrame;
  293.                      tempItem = chooseMc_1.itemType;
  294.                      chooseMc_1.gotoAndStop([chooseMc_0.itemType]);
  295.                      chooseMc_0.gotoAndStop(tempItem);
  296.                      chooseMc_1.itemType = chooseMc_0.itemType;
  297.                      chooseMc_0.itemType = tempItem;
  298.                      chooseMc_0.outFrame = 1;
  299.                      chooseMc_1.outFrame = 1;
  300.                      chooseMc_0.bg_mc.gotoAndStop(1);
  301.                      chooseMc_1.bg_mc.gotoAndStop(1);
  302.                      chooseMc_0._visible = chooseMc_1._visible = 1;
  303.                      chooseMc_0.mc.gotoAndStop(2);
  304.                      chooseMc_1.mc.gotoAndStop(2);
  305.                      view0Mc._visible = 0;
  306.                      view1Mc._visible = 0;
  307.                      changeEND();
  308.                   }
  309.                }
  310.             }
  311.          }
  312.       };
  313.    }
  314.    else
  315.    {
  316.       chooseMc_0.enabled = true;
  317.       chooseMc_1.enabled = true;
  318.       chooseMc_0.outFrame = 1;
  319.       chooseMc_1.outFrame = 1;
  320.       chooseMc_0.bg_mc.gotoAndStop(1);
  321.       chooseMc_1.bg_mc.gotoAndStop(1);
  322.       chooseMc_1 = chooseMc_0 = null;
  323.       choose = 0;
  324.       if(!pauseMc._visible)
  325.       {
  326.          hideMc._visible = 0;
  327.       }
  328.    }
  329. };
  330. changeEND = function()
  331. {
  332.    itemEmptyGetArrRow = [];
  333.    itemEmptyGetArrCol = [];
  334.    chooseMc_0.matchJud = 0;
  335.    chooseMc_1.matchJud = 0;
  336.    chooseMc_0.itemMatchCheck(1,-1,chooseMc_0.maxNum,chooseMc_0.minNum,itemEmptyGetArrRow);
  337.    chooseMc_0.itemMatchCheck(lengGap,- lengGap,lengGap,lengGap,itemEmptyGetArrCol);
  338.    chooseMc_1.itemMatchCheck(1,-1,chooseMc_1.maxNum,chooseMc_1.minNum,itemEmptyGetArrRow);
  339.    chooseMc_1.itemMatchCheck(lengGap,- lengGap,lengGap,lengGap,itemEmptyGetArrCol);
  340.    if(chooseMc_0.matchJud || chooseMc_1.matchJud)
  341.    {
  342.       if(gageGap > 0)
  343.       {
  344.          waitTimeMc.waitTimeCheck(5,0);
  345.       }
  346.    }
  347.    else
  348.    {
  349.       badS.start(0,1);
  350.       view0Mc._visible = view1Mc._visible = 1;
  351.       chooseMc_0._visible = chooseMc_1._visible = 0;
  352.       itemGroup.onEnterFrame = function()
  353.       {
  354.          view0Mc._x += (view1X - view0Mc._x) * itemSpeed;
  355.          view0Mc._y += (view1Y - view0Mc._y) * itemSpeed;
  356.          view1Mc._x += (view0X - view1Mc._x) * itemSpeed;
  357.          view1Mc._y += (view0Y - view1Mc._y) * itemSpeed;
  358.          if(view0Mc._x > view1X - 1 && view0Mc._x < view1X + 1)
  359.          {
  360.             if(view0Mc._y > view1Y - 1 && view0Mc._y < view1Y + 1)
  361.             {
  362.                if(view1Mc._x > view0X - 1 && view1Mc._x < view0X + 1)
  363.                {
  364.                   if(view1Mc._y > view0Y - 1 && view1Mc._y < view0Y + 1)
  365.                   {
  366.                      delete this.onEnterFrame;
  367.                      chooseMc_0.itemType = view0Mc.itemType;
  368.                      chooseMc_1.itemType = view1Mc.itemType;
  369.                      chooseMc_0.gotoAndStop(chooseMc_0.itemType);
  370.                      chooseMc_1.gotoAndStop(chooseMc_1.itemType);
  371.                      chooseMc_0.enabled = true;
  372.                      chooseMc_1.enabled = true;
  373.                      chooseMc_0.outFrame = 1;
  374.                      chooseMc_1.outFrame = 1;
  375.                      chooseMc_0.bg_mc.gotoAndStop(1);
  376.                      chooseMc_1.bg_mc.gotoAndStop(1);
  377.                      chooseMc_0._visible = chooseMc_1._visible = 1;
  378.                      chooseMc_0.mc.gotoAndStop(1);
  379.                      chooseMc_1.mc.gotoAndStop(1);
  380.                      chooseMc_1 = chooseMc_0 = null;
  381.                      choose = 0;
  382.                      if(!pauseMc._visible)
  383.                      {
  384.                         hideMc._visible = 0;
  385.                      }
  386.                      view0Mc.removeMovieClip();
  387.                      view1Mc.removeMovieClip();
  388.                   }
  389.                }
  390.             }
  391.          }
  392.       };
  393.    }
  394. };
  395. itemEmptyCheck = function()
  396. {
  397.    scorePlus(currentScore);
  398.    currentScore = 0;
  399.    mcNum = lengGap * lengGap;
  400.    itemEmptyMcArr = [];
  401.    viewEmptyMcArr = [];
  402.    k = 0;
  403.    while(k < lengGap - 1)
  404.    {
  405.       h = 0;
  406.       while(h < lengGap)
  407.       {
  408.          if(!itemGroup["item_" + (mcNum - h)]._visible || itemGroup["item_" + (mcNum - h)].lightMc._currentframe > 1)
  409.          {
  410.             itemGroup["item_" + (mcNum - h)]._visible = 0;
  411.             itemGroup["item_" + (mcNum - h)].lightMc.gotoAndStop(1);
  412.             itemEmptyMcArr.push(itemGroup["item_" + (mcNum - h)]);
  413.             tempNum = 1000 + viewEmptyMcArr.length;
  414.             temp = moveItem.itemMc.duplicateMovieClip("view" + tempNum,tempNum);
  415.             temp._x = itemGroup["item_" + (mcNum - h)]._x;
  416.             temp._y = itemGroup["item_" + (mcNum - h)]._y;
  417.             viewEmptyMcArr.push(temp);
  418.             tempMcNum = "";
  419.             g = 1;
  420.             while(g < 8)
  421.             {
  422.                if(itemGroup["item_" + (mcNum - h - g * lengGap)]._visible)
  423.                {
  424.                   tempMcNum = mcNum - h - g * lengGap;
  425.                   break;
  426.                }
  427.                g++;
  428.             }
  429.             if(tempMcNum == "")
  430.             {
  431.                tempFrame = random(itemLengChk) + 1;
  432.             }
  433.             else
  434.             {
  435.                tempFrame = itemGroup["item_" + tempMcNum].itemType;
  436.                itemGroup["item_" + tempMcNum]._visible = 0;
  437.             }
  438.             itemGroup["item_" + (mcNum - h)].itemType = tempFrame;
  439.             itemGroup["item_" + (mcNum - h)].gotoAndStop(tempFrame);
  440.             itemGroup["item_" + (mcNum - h)].mc.gotoAndStop(1);
  441.             temp.gotoAndStop(tempFrame);
  442.             temp.mc.gotoAndStop(1);
  443.          }
  444.          h++;
  445.       }
  446.       mcNum -= lengGap;
  447.       k++;
  448.    }
  449.    k = 1;
  450.    while(k < lengGap + 1)
  451.    {
  452.       if(!itemGroup["item_" + k]._visible || itemGroup["item_" + k].lightMc._currentframe > 1)
  453.       {
  454.          itemEmptyMcArr.push(itemGroup["item_" + k]);
  455.          tempNum = 1000 + viewEmptyMcArr.length;
  456.          temp = moveItem.itemMc.duplicateMovieClip("view" + tempNum,tempNum);
  457.          temp._x = itemGroup["item_" + k]._x;
  458.          temp._y = itemGroup["item_" + k]._y;
  459.          viewEmptyMcArr.push(temp);
  460.          ran = random(itemLengChk) + 1;
  461.          itemGroup["item_" + k].itemType = ran;
  462.          itemGroup["item_" + k].gotoAndStop(ran);
  463.          itemGroup["item_" + k].mc.gotoAndStop(1);
  464.          itemGroup["item_" + k]._visible = 0;
  465.          itemGroup["item_" + k].lightMc.gotoAndStop(1);
  466.          temp.gotoAndStop(ran);
  467.          temp.mc.gotoAndStop(1);
  468.       }
  469.       k++;
  470.    }
  471.    moveItem.movedMcInitY();
  472. };
  473. roopNoMatchCHK = function()
  474. {
  475.    matchCHK = 0;
  476.    k = 1;
  477.    while(k < 65)
  478.    {
  479.       chkMc = itemGroup["item_" + k];
  480.       chkMcFrame = chkMc._currentframe;
  481.       cx = chkMc.mcx;
  482.       cy = chkMc.mcy;
  483.       if(cx < 8)
  484.       {
  485.          chkNum = (cy - 1) * 8 + (cx + 1);
  486.          chkCX = itemGroup["item_" + chkNum].mcx;
  487.          chkCY = itemGroup["item_" + chkNum].mcy;
  488.          if(matchFrameCHK(chkNum,chkCX,chkCY))
  489.          {
  490.             matchCHK++;
  491.             break;
  492.          }
  493.       }
  494.       if(cx > 1)
  495.       {
  496.          chkNum = (cy - 1) * 8 + (cx - 1);
  497.          chkCX = itemGroup["item_" + chkNum].mcx;
  498.          chkCY = itemGroup["item_" + chkNum].mcy;
  499.          if(matchFrameCHK(chkNum,chkCX,chkCY))
  500.          {
  501.             matchCHK++;
  502.             break;
  503.          }
  504.       }
  505.       if(cy < 8)
  506.       {
  507.          chkNum = cy * 8 + cx;
  508.          chkCX = itemGroup["item_" + chkNum].mcx;
  509.          chkCY = itemGroup["item_" + chkNum].mcy;
  510.          if(matchFrameCHK(chkNum,chkCX,chkCY))
  511.          {
  512.             matchCHK++;
  513.             break;
  514.          }
  515.       }
  516.       if(cy > 1)
  517.       {
  518.          chkNum = (cy - 2) * 8 + cx;
  519.          chkCX = itemGroup["item_" + chkNum].mcx;
  520.          chkCY = itemGroup["item_" + chkNum].mcy;
  521.          if(matchFrameCHK(chkNum,chkCX,chkCY))
  522.          {
  523.             matchCHK++;
  524.             break;
  525.          }
  526.       }
  527.       k++;
  528.    }
  529.    if(matchCHK)
  530.    {
  531.       trace("ok");
  532.       continuedGame();
  533.    }
  534.    else
  535.    {
  536.       trace("no");
  537.       reflashMc.gotoAndPlay(2);
  538.    }
  539. };
  540. matchFrameCHK = function(no, x, y)
  541. {
  542.    breakCHK = 0;
  543.    if(x < 7)
  544.    {
  545.       chkW0McFrame = itemGroup["item_" + (no + 1)]._currentframe;
  546.       chkW1McFrame = itemGroup["item_" + (no + 2)]._currentframe;
  547.       if(chkMc != itemGroup["item_" + (no + 1)])
  548.       {
  549.          if(chkMcFrame == chkW0McFrame && chkMcFrame == chkW1McFrame)
  550.          {
  551.             breakCHK++;
  552.          }
  553.       }
  554.    }
  555.    if(y < 7)
  556.    {
  557.       chkW0McFrame = itemGroup["item_" + (no + 8)]._currentframe;
  558.       chkW1McFrame = itemGroup["item_" + (no + 16)]._currentframe;
  559.       if(chkMc != itemGroup["item_" + (no + 8)])
  560.       {
  561.          if(chkMcFrame == chkW0McFrame && chkMcFrame == chkW1McFrame)
  562.          {
  563.             breakCHK++;
  564.          }
  565.       }
  566.    }
  567.    if(x > 2)
  568.    {
  569.       chkW0McFrame = itemGroup["item_" + (no - 1)]._currentframe;
  570.       chkW1McFrame = itemGroup["item_" + (no - 2)]._currentframe;
  571.       if(chkMc != itemGroup["item_" + (no - 1)])
  572.       {
  573.          if(chkMcFrame == chkW0McFrame && chkMcFrame == chkW1McFrame)
  574.          {
  575.             breakCHK++;
  576.          }
  577.       }
  578.    }
  579.    if(y > 2)
  580.    {
  581.       chkW0McFrame = itemGroup["item_" + (no - 8)]._currentframe;
  582.       chkW1McFrame = itemGroup["item_" + (no - 16)]._currentframe;
  583.       if(chkMc != itemGroup["item_" + (no - 8)])
  584.       {
  585.          if(chkMcFrame == chkW0McFrame && chkMcFrame == chkW1McFrame)
  586.          {
  587.             breakCHK++;
  588.          }
  589.       }
  590.    }
  591.    if(breakCHK)
  592.    {
  593.       return true;
  594.    }
  595.    return false;
  596. };
  597. reflashItemMc = function()
  598. {
  599.    itemEmptyMcArr = [];
  600.    k = 1;
  601.    while(k < 65)
  602.    {
  603.       itemEmptyMcArr.push(itemGroup["item_" + k]);
  604.       itemGroup["item_" + k].ran = random(itemLengChk);
  605.       itemGroup["item_" + k].itemType = itemArr[itemGroup["item_" + k].ran];
  606.       itemGroup["item_" + k].gotoAndStop(itemGroup["item_" + k].itemType);
  607.       itemGroup["item_" + k].mc.gotoAndStop(1);
  608.       k++;
  609.    }
  610. };
  611. MovieClip.prototype.movedMcInitY = function()
  612. {
  613.    this._y = this.initY + 30;
  614.    this.onEnterFrame = function()
  615.    {
  616.       this._y += (this.initY - this._y) * 0.8;
  617.       if(this._y < this.initY + 0.5)
  618.       {
  619.          delete this.onEnterFrame;
  620.          this._y = this.initY;
  621.          x = 0;
  622.          while(x < viewEmptyMcArr.length)
  623.          {
  624.             viewEmptyMcArr[x].removeMovieClip();
  625.             itemEmptyMcArr[x]._visible = 1;
  626.             x++;
  627.          }
  628.          scoreCheck();
  629.       }
  630.    };
  631. };
  632. scoreCheck = function()
  633. {
  634.    if(levelNum < 20)
  635.    {
  636.       if(scoreNum >= targetScore)
  637.       {
  638.          gamePlay = false;
  639.          if(levelNum >= 20)
  640.          {
  641.             endMc._visible = 1;
  642.          }
  643.          else
  644.          {
  645.             if(bn == 4)
  646.             {
  647.                successBoard.gotoAndStop(2);
  648.             }
  649.             else
  650.             {
  651.                successBoard.gotoAndStop(1);
  652.             }
  653.             successBoard._visible = 1;
  654.          }
  655.          clearS.gotoAndPlay(4);
  656.          deleteAllItemMc();
  657.       }
  658.       else
  659.       {
  660.          waitTimeMc.waitTimeCheck(5,1);
  661.       }
  662.    }
  663.    else
  664.    {
  665.       waitTimeMc.waitTimeCheck(5,1);
  666.    }
  667. };
  668. gamePause = function(chk)
  669. {
  670.    if(gamePlay)
  671.    {
  672.       if(chk)
  673.       {
  674.          hideMc._visible = 1;
  675.          pauseMc._alpha = 100;
  676.          pauseMc._visible = 1;
  677.          delete missionMc02.onEnterFrame;
  678.          missionMc02.gotoAndStop(1);
  679.          pauseTime = gageMc.PT;
  680.          delete gageMc.onEnterFrame;
  681.       }
  682.       else
  683.       {
  684.          hideMc._visible = 0;
  685.          pauseMc._alpha = 0;
  686.          pauseMc._visible = 0;
  687.          missionMc02.mission02WaitCHK();
  688.          gageMc.timeCheckStart();
  689.       }
  690.    }
  691. };
  692. gameOver = function()
  693. {
  694.    bgS.stop();
  695.    gamePlay = false;
  696.    delete waitTimeMc.onEnterFrame;
  697.    delete this.onEnterFrame;
  698.    deleteAllItemMc();
  699.    gameOverBoard._visible = 1;
  700.    gamePT = Math.floor(getTimer() / 1000 - gameST);
  701.    sendData = new LoadVars();
  702.    sendData.ot1 = ot1;
  703.    sendData.ot2 = ot2;
  704.    sendData.ot3 = ot3;
  705.    sendData.ot4 = ot4;
  706.    sendData.ot5 = ot5;
  707.    sendData.uid = uid;
  708.    sendData.pt = scoreNum;
  709.    sendData.rt = gamePT;
  710.    sendData.sendAndLoad("http://www.gameangel.com/System/gameangel/game_rank.proc.php",sendData,"POST");
  711.    sendData.onLoad = function()
  712.    {
  713.       gameOverBoard.idTxt.text = this.nick;
  714.       gameOverBoard.rankTMC.makedNumbering(this.rank);
  715.       gameOverBoard.scoreTMC.makedNumbering(scoreNum);
  716.    };
  717. };
  718. deleteAllItemMc = function()
  719. {
  720.    delete gageMc.onEnterFrame;
  721.    delete itemGroup.onEnterFrame;
  722.    delete waitTimeMc.onEnterFrame;
  723.    delete missionMc02.onEnterFrame;
  724.    missionMc02.gotoAndStop(1);
  725.    hideMc._visible = 1;
  726.    view0Mc.itemMcMovedDown();
  727.    view1Mc.itemMcMovedDown();
  728.    this.onEnterFrame = function()
  729.    {
  730.       leng = random(30) + 30;
  731.       k = 0;
  732.       while(k < leng)
  733.       {
  734.          ran = random(dupItemMcArr.length);
  735.          dupItemMcArr[ran].itemMcMovedDown();
  736.          dupItemMcArr.splice(ran,1);
  737.          if(!dupItemMcArr.length)
  738.          {
  739.             delete this.onEnterFrame;
  740.          }
  741.          k++;
  742.       }
  743.    };
  744. };
  745. MovieClip.prototype.hideMcLoad = function()
  746. {
  747.    hideMc = this;
  748.    this.onRelease = function()
  749.    {
  750.    };
  751.    this.useHandCursor = false;
  752.    this._alpha = 0;
  753.    this._visible = 1;
  754. };
  755. MovieClip.prototype.loadedMcLoad = function()
  756. {
  757.    this.maskMc._xscale = 0;
  758.    this.onEnterFrame = function()
  759.    {
  760.       this.loadedBytes = getBytesLoaded();
  761.       this.totalBytes = getBytesTotal();
  762.       this.scale = this.loadedBytes / this.totalBytes * 100;
  763.       this.maskMc._xscale += (this.scale - this.maskMc._xscale) * 0.1;
  764.       this.loadedtxt.text = Math.floor(this.maskMc._xscale) + "%";
  765.       if(this.maskMc._xscale >= 99)
  766.       {
  767.          this.loadedtxt.text = "100%";
  768.          delete this.onEnterFrame;
  769.          nextFrame();
  770.       }
  771.    };
  772. };
  773. MovieClip.prototype.waitTimeCheck = function(gap, no)
  774. {
  775.    this.gap = gap;
  776.    this.no = no;
  777.    this.startTime = getTimer() / 100;
  778.    this.onEnterFrame = function()
  779.    {
  780.       this.pastTime = getTimer() / 100 - this.startTime;
  781.       if(this.pastTime >= this.gap)
  782.       {
  783.          delete this.onEnterFrame;
  784.          if(this.no == 0)
  785.          {
  786.             itemEmptyCheck();
  787.          }
  788.          else if(this.no == 1)
  789.          {
  790.             itemEmptyGetArrRow = [];
  791.             itemEmptyGetArrCol = [];
  792.             k = 0;
  793.             while(k < itemEmptyMcArr.length)
  794.             {
  795.                itemEmptyMcArr[k].matchJud = 0;
  796.                itemEmptyMcArr[k].itemMatchCheck(1,-1,itemEmptyMcArr[k].maxNum,itemEmptyMcArr[k].minNum,itemEmptyGetArrRow);
  797.                itemEmptyMcArr[k].itemMatchCheck(lengGap,- lengGap,lengGap,lengGap,itemEmptyGetArrCol);
  798.                k++;
  799.             }
  800.             tempJud = 0;
  801.             k = 0;
  802.             while(k < itemEmptyMcArr.length)
  803.             {
  804.                if(itemEmptyMcArr[k].matchJud)
  805.                {
  806.                   tempJud++;
  807.                }
  808.                k++;
  809.             }
  810.             if(tempJud)
  811.             {
  812.                waitTimeMc.waitTimeCheck(5,0);
  813.             }
  814.             else
  815.             {
  816.                roopNoMatchCHK();
  817.             }
  818.          }
  819.       }
  820.    };
  821. };
  822. continuedGame = function()
  823. {
  824.    chooseMc_0.enabled = true;
  825.    chooseMc_1.enabled = true;
  826.    chooseMc_0.outFrame = 1;
  827.    chooseMc_1.outFrame = 1;
  828.    chooseMc_0.bg_mc.gotoAndStop(1);
  829.    chooseMc_1.bg_mc.gotoAndStop(1);
  830.    chooseMc_0.mc.gotoAndStop(1);
  831.    chooseMc_1.mc.gotoAndStop(1);
  832.    chooseMc_1 = chooseMc_0 = null;
  833.    choose = 0;
  834.    if(!pauseMc._visible)
  835.    {
  836.       hideMc._visible = 0;
  837.    }
  838. };
  839. MovieClip.prototype.itemMatchCheck = function(no, num, noLeng, numLeng, Arr)
  840. {
  841.    this.matchMcArr = [];
  842.    this.frameCheck(no,noLeng,Arr);
  843.    this.frameCheck(num,numLeng,Arr);
  844.    if(this.matchMcArr.length > 1)
  845.    {
  846.       missionMatchNum = 0;
  847.       if(mission01Num == this._currentframe)
  848.       {
  849.          missionGap = 2;
  850.       }
  851.       else if(mission02Num == this._currentframe)
  852.       {
  853.          missionGap = 1;
  854.          k = 0;
  855.          while(k < dupItemMcArr.length)
  856.          {
  857.             if(dupItemMcArr[k] != this)
  858.             {
  859.                jud = 0;
  860.                h = 0;
  861.                while(h < this.matchMcArr.length)
  862.                {
  863.                   if(this.matchMcArr[h] == dupItemMcArr[k])
  864.                   {
  865.                      jud++;
  866.                      break;
  867.                   }
  868.                   h++;
  869.                }
  870.                if(!jud)
  871.                {
  872.                   if(dupItemMcArr[k]._currentframe == this._currentframe)
  873.                   {
  874.                      missionMatchNum++;
  875.                      dupItemMcArr[k].mc.gotoAndStop(3);
  876.                      dupItemMcArr[k].lightMc.gotoAndPlay(2);
  877.                   }
  878.                }
  879.             }
  880.             k++;
  881.          }
  882.       }
  883.       else
  884.       {
  885.          missionGap = 1;
  886.       }
  887.       plus = (missionMatchNum + 30 + (this.matchMcArr.length - 2) * 5) * missionGap;
  888.       currentScore += plus;
  889.       this.matchJud = this.matchJud + 1;
  890.       tempGap = Math.floor((missionMatchNum + this.matchMcArr.length - 2) / 2) + 2;
  891.       gageGap += tempGap;
  892.       trace("gageGap : " + tempGap);
  893.       this.mc.gotoAndStop(3);
  894.       this.lightMc.gotoAndPlay(2);
  895.       w = 0;
  896.       while(w < this.matchMcArr.length)
  897.       {
  898.          this.matchMcArr[w].mc.gotoAndStop(3);
  899.          this.matchMcArr[w].lightMc.gotoAndPlay(2);
  900.          w++;
  901.       }
  902.       goodS.start(0,1);
  903.    }
  904.    else
  905.    {
  906.       this.mc.gotoAndStop(1);
  907.    }
  908. };
  909. MovieClip.prototype.frameCheck = function(plusGap, leng, Arr)
  910. {
  911.    this.gap = 0;
  912.    this.tempJud = 0;
  913.    z = 0;
  914.    while(z < Arr.length)
  915.    {
  916.       if(this._name == Arr[z])
  917.       {
  918.          this.tempJud = this.tempJud + 1;
  919.          break;
  920.       }
  921.       z++;
  922.    }
  923.    if(!this.tempJud)
  924.    {
  925.       l = 1;
  926.       while(l <= leng)
  927.       {
  928.          this.gap += plusGap;
  929.          this.other = this._parent["item_" + (this.no + this.gap)].itemType;
  930.          if(this.itemType != this.other)
  931.          {
  932.             break;
  933.          }
  934.          Arr.push(this._parent["item_" + (this.no + this.gap)]._name);
  935.          this.matchMcArr.push(this._parent["item_" + (this.no + this.gap)]);
  936.          l++;
  937.       }
  938.    }
  939. };
  940. MovieClip.prototype.itemDoubleCheck = function(no)
  941. {
  942.    this.no = no;
  943.    this.div = this.no % lengGap;
  944.    if(this.div)
  945.    {
  946.       this.minNum = this.no - (Math.floor(this.no / lengGap) * lengGap + 1);
  947.       this.maxNum = Math.floor(this.no / lengGap) * lengGap + 1 + lengGap - 1 - this.no;
  948.    }
  949.    else
  950.    {
  951.       this.maxNum = 0;
  952.       this.minNum = lengGap - 1;
  953.    }
  954.    this.ran = random(itemLengChk);
  955.    this.itemType = itemArr[this.ran];
  956.    this.gotoAndStop(this.itemType);
  957.    this.mc.gotoAndStop(1);
  958. };
  959. MovieClip.prototype.itemMcMovedDown = function()
  960. {
  961.    this.firstY = this._y - 30;
  962.    this.firstX = this._x - 20 + random(40);
  963.    this.onEnterFrame = function()
  964.    {
  965.       this._x += (this.firstX - this._x) * 0.6;
  966.       this._y += (this.firstY - this._y) * 0.6;
  967.       if(this._y < this.firstY + 1)
  968.       {
  969.          this.onEnterFrame = function()
  970.          {
  971.             this._y += 40;
  972.             if(this._y > 440)
  973.             {
  974.                delete this.onEnterFrame;
  975.                this.removeMovieClip();
  976.             }
  977.          };
  978.       }
  979.    };
  980. };
  981. MovieClip.prototype.mission02WaitCHK = function()
  982. {
  983.    this.ST = getTimer() / 1000;
  984.    this.GAP = random(8) + 8;
  985.    this.onEnterFrame = function()
  986.    {
  987.       this.PT = getTimer() / 1000 - this.ST;
  988.       if(this.PT > this.GAP)
  989.       {
  990.          delete this.onEnterFrame;
  991.          missionChkArr = [0,0,0,0,0,0,0,0];
  992.          k = 0;
  993.          while(k < dupItemMcArr.length)
  994.          {
  995.             if(mission01Num != dupItemMcArr[k]._currentframe)
  996.             {
  997.                chk = dupItemMcArr[k]._currentframe - 1;
  998.                missionChkArr[chk]++;
  999.             }
  1000.             k++;
  1001.          }
  1002.          jud = 0;
  1003.          k = 1;
  1004.          while(k < missionChkArr.length)
  1005.          {
  1006.             if(missionChkArr[jud] < missionChkArr[k])
  1007.             {
  1008.                jud = k;
  1009.             }
  1010.             k++;
  1011.          }
  1012.          this.gotoAndPlay(2);
  1013.       }
  1014.    };
  1015. };
  1016. MovieClip.prototype.missionViewCHK = function()
  1017. {
  1018.    this.ST = getTimer() / 100;
  1019.    mission02Num = itemArr[jud];
  1020.    this.mc.gotoAndStop(mission02Num);
  1021.    this.onEnterFrame = function()
  1022.    {
  1023.       this.PT = getTimer() / 100 - this.ST;
  1024.       if(this.PT > 35)
  1025.       {
  1026.          delete this.onEnterFrame;
  1027.          mission02Num = 0;
  1028.          this.play();
  1029.          this.mission02WaitCHK();
  1030.       }
  1031.    };
  1032. };
  1033. MovieClip.prototype.soundConMcLoad = function()
  1034. {
  1035.    this.onRelease = function()
  1036.    {
  1037.       if(this._currentframe == 1)
  1038.       {
  1039.          bgS.stop();
  1040.          soundCHK(0);
  1041.          this.onEnterFrame = function()
  1042.          {
  1043.             if(this._currentframe == this._totalframes)
  1044.             {
  1045.                this.stop();
  1046.                delete this.onEnterFrame;
  1047.             }
  1048.             else
  1049.             {
  1050.                this.nextFrame();
  1051.             }
  1052.          };
  1053.       }
  1054.       else
  1055.       {
  1056.          bgS.start(0,999);
  1057.          soundCHK(100);
  1058.          this.onEnterFrame = function()
  1059.          {
  1060.             if(this._currentframe == 1)
  1061.             {
  1062.                this.stop();
  1063.                delete this.onEnterFrame;
  1064.             }
  1065.             else
  1066.             {
  1067.                this.prevFrame();
  1068.             }
  1069.          };
  1070.       }
  1071.    };
  1072. };
  1073. soundCHK = function(chk)
  1074. {
  1075.    goodS.setVolume(chk);
  1076.    badS.setVolume(chk);
  1077.    startS.setVolume(chk);
  1078.    endS.setVolume(chk);
  1079.    bgS.setVolume(chk);
  1080.    timeS.setVolume(chk);
  1081.    if(chk > 0)
  1082.    {
  1083.       clickS.setVolume(chk);
  1084.    }
  1085.    else
  1086.    {
  1087.       clickS.setVolume(0);
  1088.    }
  1089. };
  1090. MovieClip.prototype.makedNumbering = function(num)
  1091. {
  1092.    numStr = num.toString();
  1093.    leng = numStr.length;
  1094.    k = 0;
  1095.    while(k < leng)
  1096.    {
  1097.       frameN = Number(numStr.substr(leng - 1 - k,1)) + 2;
  1098.       this["mc" + k].gotoAndStop(frameN);
  1099.       k++;
  1100.    }
  1101. };
  1102. MovieClip.prototype.moveItemMcLoad = function()
  1103. {
  1104.    moveItem = this;
  1105.    this.itemMc._visible = 0;
  1106.    this.initY = this._y;
  1107. };
  1108. init();
  1109.